#define _CRT_SECURE_NO_WARNINGS



//https://www.luogu.com.cn/problem/P1744



#include<iostream>
#include<cmath>
#include<cstring>
using namespace std;
const int N = 110, M = 1010;
int n, m, s, t;
double x[N], y[N];
double dist[N];
struct node
{
	int u, v;
	double w;
}e[M];
double calc(int i, int j)
{
	double dx = x[i] - x[j];
	double dy = y[i] - y[j];
	return sqrt(dx * dx + dy * dy);
}

void bf()
{
	for (int i = 1; i <= n; i++)
		dist[i] = 1e10;
	dist[s] = 0;
	for (int i = 1; i < n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			int u = e[j].u;
			int v = e[j].v;
			double w = e[j].w;
			if (dist[u] + w < dist[v])
				dist[v] = dist[u] + w;
			if (dist[v] + w < dist[u])
				dist[u] = dist[v] + w;
		}
	}
}
int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> x[i] >> y[i];
	cin >> m;
	for (int i = 1; i <= m; i++)
	{
		int u, v;
		cin >> u >> v;
		e[i].u = u;
		e[i].v = v;
		e[i].w = calc(u, v);

	}
	cin >> s >> t;
	bf();
	printf("%.2lf\n", dist[t]);
	return 0;
}


